import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "home",
    component: () => import("../views/HomeView.vue"),
    // children: [

    // ],
  },
  {
    path: "/RealAlarm",
    name: "RealAlarm",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/RealAlarm.vue"),
  },
  {
    path: "/HistoryAlarm",
    name: "HistoryAlarm",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/HistoryAlarm.vue"),
  },
  {
    path: "/HistoryLine",
    name: "HistoryLine",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/HistoryLine.vue"),
  },
  {
    path: "/ReportForm",
    name: "ReportForm",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/ReportForm.vue"),
  },
  {
    path: "/Inspection",
    name: "Inspection",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/Inspection.vue"),
  },
  {
    path: "/Overhaul",
    name: "Overhaul",
    component: () =>
      import(/* webpackChunkName: "about" */ "../views/Overhaul.vue"),
  },
  // {
  //   path: "about",
  //   name: "about",
  //   // route level code-splitting
  //   // this generates a separate chunk (about.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () =>
  //     import(/* webpackChunkName: "about" */ "../views/AboutView.vue"),
  // },
];

const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch((err) => err);
};

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});
export default router;
